#!/usr/bin/env python
# -*- coding: utf-8 -*-

#
# This program is free software; you can redistribute it and/or modify  
# it under the terms of the GNU General Public License as published by  
# the Free Software Foundation; either version 2 of the License, or     
# (at your option) any later version.                                   
#                                                                         
# A copy of the license can be found in the license.txt file supplied   
# with this software or at: http://www.gnu.org/copyleft/gpl.html       
#


from proxy import Proxy


class   PassByProxy(Proxy) :
    def __init__(self, url, callin_listener) :
        '''
        @param url URL of remote EndPoint connected to
        '''
        self.url = url
        self.delegator = callin_listener
        ## __init__()

    def callout(self, method, parameters) :
        return self.proxy.callin(method, parameter)
        ## callout

    def open(self) :
        pass
        ## open()

    def close(self) :
        pass
        ## close()

    def ping(self) :
        return True
        ## ping()

    #### --------------------------------------------------------- ####
    #### callin method list

    def getID(self) :
        return self.delegator.getID()
        ## getID()

    def getSuccessor(self) :
        return self.delegator.getSuccessor()
        ## getSuccessor()

    def findClosestPrecedingFinger(self, id) :
        return self.delegator.findClosestPrecedingFinger(id)
        ## findClosestPrecedingFinger()

    def updateFingerTable(self, node, i) :
        return self.delegator.updateFingerTable(node, i)
        ## updateFingerTable()

    def getInterval(self) :
        return self.delegator.getInterval()
        ## getInterval()

    def getReplicas(self) :
        return self.delegator.getReplicas()
        ## getReplicas()

    #### --------------------------------------------------------- ####

    def insert(self, key_id, key, data, timestamp) :
        return self.delegator.insert(key_id, key, data, timestamp)
        ## insert()

    def retrieve(self, key_id, key, timestamp) :
        return self.delegator.retrieve(key_id, key, timestamp)
        ## retrieve()

    def remove(self, key_id, key, timestamp) :
        return self.delegator.remove(key_id, key, timestamp)
        ## remove()

    #### --------------------------------------------------------- ####

    ## class Proxy

